package ru.st.selenium.applogic1;

import org.openqa.selenium.By;
import ru.st.selenium.model.User;
import ru.st.selenium.applogic.UserHelper;

public class UserHelper1 extends DriverBasedHelper implements UserHelper{

	  public UserHelper1(ApplicationManager1 manager) {
	    super(manager.getWebDriver());
	  }

	  @Override
	  public void loginAs(User user) {
	    pages.loginPage.ensurePageLoaded()
	      .setUsernameField(user.getLogin())
	      .setPasswordField(user.getPassword())
	      .clickSubmitButton();
	  }

	  @Override
	  public void logout() {
	    pages.internalPage.ensurePageLoaded()
	      .clickLogoutLink();
	  }
	  @Override
	  public boolean isLoggedIn() {
	    return pages.internalPage.waitPageLoaded();
	  }

	 
	  @Override
	  public boolean isNotLoggedIn() {
	    return pages.loginPage.waitPageLoaded();
	  }
	 



	}



